Ponder.registry((event) => {
    event.create("eou:electric_arc_furnace/controller").scene("electric_arc_furnace", "建造电弧炉的过程", (scene, util) => {
        scene.showStructure()
        let showCustomMachine = (pos, block, use_particle) => {
            scene.world.setBlocks(pos, use_particle, "custommachinery:custom_machine_block");
            scene.world.modifyBlockEntityNBT(pos, nbt => {
                nbt.machineID = block
            })
        }
        showCustomMachine([0, 1, 0], "eou:electric_arc_furnace/controller", true)
        showCustomMachine([1, 1, 0], "eou:electric_arc_furnace/power_port", true);
        showCustomMachine([2, 1, 0], "eou:electric_arc_furnace/exportation_port", true);
        showCustomMachine([0, 2, 0], "eou:electric_arc_furnace/feed_port", true);

        scene.world.setBlocks([1, 2, 0], true, 'eou:arc_furnace_coil');
        scene.world.setBlocks([2, 2, 0], true, 'eou:arc_furnace_shell');
        scene.text(60, "你需要这些方块建造电弧炉", [1.5, 1.5, 0])
            .colored(PonderPalette.RED)
            .placeNearTarget()
            .attachKeyFrame();
        scene.idle(80);
        scene.text(80, "注意输出口，输入口，能量口，只有带特殊颜色的面可以进行自动化。", [1.5, 1.5, 0])
            .colored(PonderPalette.RED)
            .placeNearTarget()
            .attachKeyFrame();
        scene.idle(100);

        scene.world.setBlocks([0, 1, 0, 2, 2, 0], true, "minecraft:air")
        scene.idle(10)

        showCustomMachine([2, 1, 1], "eou:electric_arc_furnace/controller", true)
        scene.text(40, "先放置一个控制器", [2.5, 1.5, 1.5])
            .colored(PonderPalette.RED)
            .placeNearTarget()
            .attachKeyFrame();
        scene.idle(60)

        showCustomMachine([1, 1, 2], "eou:electric_arc_furnace/power_port", true)
        scene.text(40, "在控制器的右侧放置能量口", [1.5, 1.5, 2.5])
            .colored(PonderPalette.RED)
            .placeNearTarget()
            .attachKeyFrame();
        scene.idle(60)

        showCustomMachine([2, 1, 3], "eou:electric_arc_furnace/exportation_port", true)
        scene.text(40, "在控制器的后面放置输出口", [2.5, 1.5, 3.5])
            .colored(PonderPalette.RED)
            .placeNearTarget()
            .attachKeyFrame();
        scene.idle(60)

        scene.world.modifyBlock([2, 1, 3], (curState) => curState.with("facing", "south"), true);
        scene.world.modifyBlock([1, 1, 2], (curState) => curState.with("facing", "west"), true);
        scene.text(40, "记得把能量口和输出口的方向调整的特殊颜色向外", [2.5, 1.5, 2.5])
            .colored(PonderPalette.RED)
            .placeNearTarget()
            .attachKeyFrame();
        scene.idle(60)

        scene.world.setBlocks([1, 1, 1], true, 'eou:arc_furnace_shell');
        scene.world.setBlocks([1, 1, 3], true, 'eou:arc_furnace_shell');
        scene.world.setBlocks([2, 1, 2], true, 'eou:arc_furnace_shell');
        scene.world.setBlocks([3, 1, 1], true, 'eou:arc_furnace_shell');
        scene.world.setBlocks([3, 1, 2], true, 'eou:arc_furnace_shell');
        scene.world.setBlocks([3, 1, 3], true, 'eou:arc_furnace_shell');
        scene.text(40, "剩下的位置补上电弧炉外壳，第一层完成", [2.5, 2.5, 2.5])
            .colored(PonderPalette.RED)
            .placeNearTarget()
            .attachKeyFrame();
        scene.idle(60)

        scene.world.setBlocks([1, 2, 1], true, 'eou:arc_furnace_coil');
        scene.world.setBlocks([1, 2, 2], true, 'eou:arc_furnace_coil');
        scene.world.setBlocks([1, 2, 3], true, 'eou:arc_furnace_coil');
        scene.world.setBlocks([2, 2, 1], true, 'eou:arc_furnace_coil');
        scene.world.setBlocks([2, 2, 3], true, 'eou:arc_furnace_coil');
        scene.world.setBlocks([3, 2, 1], true, 'eou:arc_furnace_coil');
        scene.world.setBlocks([3, 2, 2], true, 'eou:arc_furnace_coil');
        scene.world.setBlocks([3, 2, 3], true, 'eou:arc_furnace_coil');
        scene.text(40, "放置一圈电弧炉线圈，注意中间不放，第二层完成", [2.5, 2.5, 2.5])
            .colored(PonderPalette.RED)
            .placeNearTarget()
            .attachKeyFrame();
        scene.idle(60)

        scene.world.setBlocks([1, 3, 1], true, 'eou:arc_furnace_coil');
        scene.world.setBlocks([1, 3, 2], true, 'eou:arc_furnace_coil');
        scene.world.setBlocks([1, 3, 3], true, 'eou:arc_furnace_coil');
        scene.world.setBlocks([2, 3, 1], true, 'eou:arc_furnace_coil');
        scene.world.setBlocks([2, 3, 3], true, 'eou:arc_furnace_coil');
        scene.world.setBlocks([3, 3, 1], true, 'eou:arc_furnace_coil');
        scene.world.setBlocks([3, 3, 2], true, 'eou:arc_furnace_coil');
        scene.world.setBlocks([3, 3, 3], true, 'eou:arc_furnace_coil');
        scene.text(40, "放置一圈电弧炉线圈，注意中间不放，第三层完成", [2.5, 3.5, 2.5])
            .colored(PonderPalette.RED)
            .placeNearTarget()
            .attachKeyFrame();
        scene.idle(60)

        scene.world.setBlocks([1, 4, 1], true, 'eou:arc_furnace_shell');
        scene.world.setBlocks([1, 4, 2], true, 'eou:arc_furnace_shell');
        scene.world.setBlocks([1, 4, 3], true, 'eou:arc_furnace_shell');
        scene.world.setBlocks([2, 4, 1], true, 'eou:arc_furnace_shell');
        scene.world.setBlocks([2, 4, 3], true, 'eou:arc_furnace_shell');
        scene.world.setBlocks([3, 4, 1], true, 'eou:arc_furnace_shell');
        scene.world.setBlocks([3, 4, 2], true, 'eou:arc_furnace_shell');
        scene.world.setBlocks([3, 4, 3], true, 'eou:arc_furnace_shell');
        scene.text(40, "放置一圈电弧炉外壳", [2.5, 3.5, 2.5])
            .colored(PonderPalette.RED)
            .placeNearTarget()
            .attachKeyFrame();
        scene.idle(60)

        showCustomMachine([2, 4, 2], "eou:electric_arc_furnace/feed_port", true)
        scene.text(40, "中间放上进料口,电弧炉搭建完成", [2.5, 4.5, 2.5])
            .colored(PonderPalette.RED)
            .placeNearTarget()
            .attachKeyFrame();
        scene.idle(60)

        scene.text(60, "如果电弧炉正常，但是不工作，请尝试重新放置一下控制器。", [2.5, 1.5, 1.5])
            .colored(PonderPalette.RED)
            .placeNearTarget()
            .attachKeyFrame();
        scene.idle(80)
        scene.text(60, "记得保持进料口里面的物品充足，否则电弧炉不会开始加工", [2.5, 4.5, 2.5])
            .colored(PonderPalette.RED)
            .placeNearTarget()
            .attachKeyFrame();
        scene.text(60, "记得保持能量口里面的能量充足，否则电弧炉会开始加工，但会使加工物品直接损失", [1.5, 1.5, 2.5])
            .colored(PonderPalette.RED)
            .placeNearTarget()
            .attachKeyFrame();
        scene.text(60, "记得定时输出输出口里面的物品，否则电弧炉会开始加工，但会使加工物品直接损失", [2.5, 2.5, 2.5])
            .colored(PonderPalette.RED)
            .attachKeyFrame();
        scene.idle(80)
    });
});